﻿using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Command;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Memorandum
{
    /// <summary>
    /// Page1.xaml 的交互逻辑
    /// </summary>
    public partial class Page1 : Page
    {
        public Page1()
        {
            InitializeComponent();
           
            this.DataContext = new TestVM();
        }
       

    }

    public class TestVM: ViewModelBase
    {
        public TestVM()
        {
            init();
        }
        private ObservableCollection<object> itemSet = new ObservableCollection<object>();

        public ObservableCollection<object> TitleCollection
        {
            get { return itemSet; }

        }
        public void init()
        {
            TitleCollection.Add(new { ImgUrl = "text", Title = "teste123", NavUrl = "1234" });
            TitleCollection.Add(new { ImgUrl = "text", Title = "teste123", NavUrl = "1234" });

            TitleCollection.Add(new { ImgUrl = "text", Title = "teste123", NavUrl = "1234" });
        }

        private string txt;

        public string Txt
        {
            get { return txt; }
            set { txt = value; }
        }

        private ICommand command;

        public ICommand Cmd
        {
            get
            { 
                if(command==null)
                {
                    command=new RelayCommand(() =>
                    {
                       

                    },
                    ()=> 
                    {
                        return string.IsNullOrEmpty(Txt);
                    });
                }
                return command;
            }
        }


    }


}
